function zip-templates($templateDir, $exclusionList)
{
    pushd $templateDir
    # generate a list of sub directories for the templates
    $templateDirs = dir . | where { $null -ne ($_ -as [System.IO.DirectoryInfo]) }
    foreach($dir in $templateDirs)
    {
        pushd $dir
        $zipFile = $dir.FullName + ".zip"
        "ZIP: $zipFile"
        if([System.IO.File]::Exists($zipFile))
        {
            del $zipFile
        }    

        $exfile = [IO.Path]::GetTempFileName()
        set-content $exFile $exclusionlist
        & $wzzip -r -p ("-x@" + "$exFile") $zipFile
        del $exfile 
        popd
    }
    popd
}

## force process CD to be same as shell CD
[System.Environment]::CurrentDirectory = pwd

## list of files to leave out of the zip
$exclusionList = ".myscmserverinfo"

zip-templates "ItemTemplates" $exclusionList
zip-templates "ProjectTemplates" $exclusionList